package zhouzhouyongche.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator; 

@Entity
@Table(uniqueConstraints={@UniqueConstraint(columnNames={"idNumber", "user_id"})})
@DynamicInsert(true)
@DynamicUpdate(true)
//乘客，乘客不等于用户，乘客为车票乘车人
public class Passenger implements Serializable{
	
	private static final long serialVersionUID = 1L;
	
	private int id;
	//乘客名字
	private String passengerName;
	
	// 0表示儿童票，1表示成人票
	private int ticketType;
	
	//默认为身份证，也只有身份证
	private String idNumber;

	@Id
	@GeneratedValue(generator = "generator")
	@GenericGenerator(name = "generator", strategy = "identity")
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}
	
	@Column(nullable = false)
	public String getPassengerName() {
		return passengerName;
	}

	public void setPassengerName(String passengerName) {
		this.passengerName = passengerName;
	}

	@Column(nullable = false)
	public int getTicketType() {
		return ticketType;
	}

	public void setTicketType(int ticketType) {
		this.ticketType = ticketType;
	}

	@Column(nullable = false)
	public String getIdNumber() {
		return idNumber;
	}

	public void setIdNumber(String idNumber) {
		this.idNumber = idNumber;
	}
}
